package com.aizuda.boot.modules.file.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.io.File;

/**
 * @author hjw
 * @description 文件夹类型枚举
 * @date 2025年06月16日 17:06
 */
@Getter
@AllArgsConstructor
public enum FileFolderTypeEnum {


    /**
     * 通用文件夹
     */
    COMMON(1, FileFolderTypeEnum.FOLDER_PUBLIC + File.separator + "common" + File.separator, "通用文件夹"),
    /**
     * 合同文件夹
     */
    CONTRACT(2, FileFolderTypeEnum.FOLDER_PUBLIC + File.separator + "contract" + File.separator, "合同文件夹"),
    /**
     * 附件文件夹
     */
    ATTACHMENT(3, FileFolderTypeEnum.FOLDER_PUBLIC + File.separator + "attachment" + File.separator, "附件文件夹"),
    /**
     * 评论文件夹
     */
    COMMENT(4, FileFolderTypeEnum.FOLDER_PUBLIC + File.separator + "comment" + File.separator, "评论文件夹"),
    /**
     * 模版文件夹
     */
    TEMPLATE(5, FileFolderTypeEnum.FOLDER_PUBLIC + File.separator + "template" + File.separator, "模版文件夹");
    /**
     * 公用读取文件夹 public
     */
    public static final String FOLDER_PUBLIC = "public";

    /**
     * 私有文件夹(预留)
     */
    public static final String FOLDER_PRIVATE = "private";

    private final Integer value;

    private final String folder;

    private final String desc;

    /**
     * 根据value获取文件夹类型枚举
     */
    public static FileFolderTypeEnum getByValue(Integer value) {
        for (FileFolderTypeEnum type : FileFolderTypeEnum.values()) {
            if (type.getValue().equals(value)) {
                return type;
            }
        }
        return null;
    }
}
